import sys
def confusionMat(verdade,classifier,n):
	tab=[[0]*n]*n
	for i in range(len(verdade)):
		tab[verdade[i]-1][classifier[i]-1]+=1
	return tab

def readvector(file):
	vect=file.readlines()
	vect=map(int,vect)
	return vect

arq1=sys.argv[1]
arq2=sys.argv[2]

arqverd = open(arq1)
arqclass=open(arq2)
verd = readvector(arqverd)
classif = readvector(arqclass)
confmat=confusionMat(verd,classif,101)
cs = open("confmat.csv","w+")
i=0
s=0.0
for x in confmat:
	v1 = sum(x)
	v2 = float(x[i])/v1
	s+=v2
	strline= ", ".join(map(str,x+[v1,v2]))
	cs.write(strline+"\n")
	i+=1
cs.close()

print s			
	
	
